<?php
/*
*
*
**/

class easyapi {

	/*
	*basic提交用户名和密码
	* */
  	protected $curl ;
	protected $user=array(); 
        
	function __construct($appKey,$name,$pwd) {
	
		$this->source = $appKey;
        $this->basic = $name.':'.$pwd;
       	
		}
		
	function get($url,$parameter=array(),$method='GET') {
	
		$lastUrl = "https://api.weibo.com/2/";
		$lastUrl .= trim($url, '/');
        $lastUrl .= '.json';
		$parameter['source'] = $this->source;
		$lastUrl .= '?source='.$parameter['source'];
		$this->curl = curl_init();
                
		curl_setopt($this->curl , CURLOPT_HTTPAUTH, CURLAUTH_BASIC ) ; 
        curl_setopt($this->curl , CURLOPT_USERPWD,$this->basic ); 
        curl_setopt($this->curl , CURLOPT_URL, $lastUrl );	
		curl_setopt($this->curl , CURLOPT_RETURNTRANSFER, 1 );
		$content = curl_exec( $this->curl );
		curl_close( $this->curl );
        return json_decode( $content, true );
		
		}
	
	}

?>